package com.itheima.d8_chooseSort;

import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        int[] numbers = {30,56,32,89,12,34,31};
        for (int i = 0; i < numbers.length-1; i++) {
            for (int j = i; j <numbers.length-1; j++) {
                if(numbers[i]>numbers[j+1]){
                    swap(numbers,i,j);
                }
            }
        }
        System.out.println(Arrays.toString(numbers));
    }
    public static  void swap(int[] numbers, int i,int j){
        int temp = numbers[j+1];
        numbers[j+1] = numbers[i];
        numbers[i] = temp;
    }
}
